package com.ruoyi.course.service.impl;

import java.util.List;

import com.ruoyi.common.constant.SysConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.course.mapper.SysCourseTeacherMapper;
import com.ruoyi.course.domain.SysCourseTeacher;
import com.ruoyi.course.service.ISysCourseTeacherService;

/**
 * 课程和讲师关联Service业务层处理
 * 
 * @author YJF
 * @date 2023-05-17
 */
@Service
public class SysCourseTeacherServiceImpl implements ISysCourseTeacherService 
{
    @Autowired
    private SysCourseTeacherMapper sysCourseTeacherMapper;

    /**
     * 查询课程和讲师关联
     * 
     * @param sysCourseTeacher 课程和讲师关联
     * @return 课程和讲师关联
     */
    @Override
    public SysCourseTeacher selectSysCourseTeacherByCourseId(SysCourseTeacher sysCourseTeacher)
    {
        return sysCourseTeacherMapper.selectSysCourseTeacherByCourseId(sysCourseTeacher);
    }

    /**
     * 查询课程和讲师关联列表
     * 
     * @param sysCourseTeacher 课程和讲师关联
     * @return 课程和讲师关联
     */
    @Override
    public List<SysCourseTeacher> selectSysCourseTeacherList(SysCourseTeacher sysCourseTeacher)
    {
        if(StringUtils.isNull( sysCourseTeacher.getDelFlag())){
            sysCourseTeacher.setDelFlag(SysConstants.CONSTANT_STR0);
        }
        return sysCourseTeacherMapper.selectSysCourseTeacherList(sysCourseTeacher);
    }

    /**
     * 新增课程和讲师关联
     * 
     * @param sysCourseTeacher 课程和讲师关联
     * @return 结果
     */
    @Override
    public int insertSysCourseTeacher(SysCourseTeacher sysCourseTeacher)
    {
        sysCourseTeacher.setCreateTime(DateUtils.getNowDate());
        sysCourseTeacher.setUpdateTime(DateUtils.getNowDate());
        return sysCourseTeacherMapper.insertSysCourseTeacher(sysCourseTeacher);
    }

    /**
     * 修改课程和讲师关联
     * 
     * @param sysCourseTeacher 课程和讲师关联
     * @return 结果
     */
    @Override
    public int updateSysCourseTeacher(SysCourseTeacher sysCourseTeacher)
    {
        sysCourseTeacher.setUpdateTime(DateUtils.getNowDate());
        return sysCourseTeacherMapper.updateSysCourseTeacher(sysCourseTeacher);
    }

    /**
     * 批量删除课程和讲师关联
     * 
     * @param ids 需要删除的课程和讲师关联主键
     * @return 结果
     */
    @Override
    public int deleteSysCourseTeacherByCourseIds(Long[] ids)
    {
        return sysCourseTeacherMapper.deleteSysCourseTeacherByCourseIds(ids);
    }

    /**
     * 删除课程和讲师关联信息
     * 
     * @param id 课程和讲师关联主键
     * @return 结果
     */
    @Override
    public int deleteSysCourseTeacherByCourseId(Long id)
    {
        return sysCourseTeacherMapper.deleteSysCourseTeacherByCourseId(id);
    }
}
